<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/views1/DTD/views1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui">

	<p:dialog widgetVar="dialogoCreateQuestao" modal="true"
		width="510" closable="true" header="Criar Questão"
		minWidth="500" resizable="false" >
		<h:form id="CriarQuestao">
		<div class="dialogo_container_18">
			<div class="dialogo_grid_3 div-dialogo-label">Código</div>
			<div class="dialogo_grid_6 div-dialogo-input">
				<p:inputText value="#{provaBean.questaoBaseInstance.codigo}" styleClass="dialogo_width_5" disabled="true"/>
			</div>
			<div class="dialogo_grid_3 div-dialogo-label">Dificuldade</div>
			<div class="dialogo_grid_6 div-dialogo-input">
				<h:selectOneMenu value="#{provaBean.questaoBaseInstance.grauDificuldade}" styleClass="dialogo_width_5">
					<f:selectItems value="#{enumBean.tipoGrauDificuldade}" var="var" />
				</h:selectOneMenu>
			</div>
			<div class="dialogo_clear"></div>
			<div class="dialogo_grid_3 div-dialogo-label">Cad. Por</div>
			<div class="dialogo_grid_6 div-dialogo-input">
				<p:inputText value="#{provaBean.questaoBaseInstance.professor.nomeCompleto}" 
					disabled="true" styleClass="dialogo_width_5" />
			</div>
			<div class="dialogo_grid_3 div-dialogo-label">Assunto</div>
			<div class="dialogo_grid_6 div-dialogo-input">
				<p:inputText value="#{provaBean.questaoBaseInstance.palavraChave.nome}" styleClass="dialogo_width_4" />
			</div>
			<div class="dialogo_grid_3 div-dialogo-label">Cabeçalho</div>
			<div class="dialogo_grid_15 div-dialogo-input">
				<p:inputTextarea value="#{provaBean.questaoBaseInstance.cabecalho}" styleClass="dialogo_width_15" 
					autoResize="false" rows="4" required="true" requiredMessage="O campo 'Cabeçalho' é obrigatório!" />
			</div>
			<div class="dialogo_grid_3" style="margin-top: 4px;">Alternativas</div>
			<div class="dialogo_grid_15 right" style="margin-top: 4px;">
				<p:commandButton value="Marcar Correta" action="#{provaBean.marcarAlterantivaCorreta}" 
					update="dataTableAlternativas" style="margin-left:4px;"/>
				<p:commandButton value="Nova" action="#{provaBean.goCreateAlternativaBase}" style="margin-left:4px;" 
					oncomplete="dialogoNovaAlternativa.show()" update=":formDialogoNovaAlterantiva"/>
				<p:commandButton value="Editar" action="#{provaBean.goEditAlternativaBase}" style="margin-left:4px;"
					oncomplete="dialogoEditarAlternativa.show()" update=":formDialogoEditarAlterantiva"/>
				<p:commandButton value="Excluir" action="#{provaBean.goDeleteAlternativaBase}" style="margin-left:4px;"
					oncomplete="dialogoDeleteAlternativa.show()"/>
			</div>
			<div class="dialogo_grid_18">
				<br/>
				<p:dataTable widgetVar="dataTableAlternativas" id="dataTableAlternativas"
					value="#{provaBean.alternativaBaseList}" 
					selection="#{provaBean.alternativaBaseInstance}"
					var="var" emptyMessage="Nenhuma alternativa!" 
					selectionMode="single">
					<p:column headerText="Texto">
						<h:outputText value="#{var.texto}" />
					</p:column>
					<p:column headerText="Correta?">
					SIM
					</p:column>		
				</p:dataTable>
			</div>
		</div>
		</h:form>
	</p:dialog>
</f:view>